facebook_status()
String(字符串)
With this function you can poll Facebook for the current status of the user login. One of the following strings is returned (note that they are always returned in capital letters):
- AUTHORISED: This means that the user has logged in correctly, but not all permissions may have been granted.
- PROCESSING: This is returned when the login process is currently un-resolved.
- IDLE: This is returned when the connection to the Facebook API has been initialised but no further action has been taken (ie: no user is logged in).
- FAILED: This means that the user has not logged in correctly, usually due to a connection error.
Note that this function does not continuously check the Facebook API and will only be updated after a Facebook action has been resolved (like logging in, logging out or requesting permissions).
switch (facebook_status())
{
case "AUTHORISED": global.Auth = true; instance_destroy(); break;
case "FAILED": facebook_login(permissions); alarm[0] = 30; break;
default: alarm[0] = 30;
}
The above code would be run in an alarm and checks the status of Facebook to see if the user has logged in correctly. If the return string is "AUTHORISED", a global variable is set to true and the game continues, if the return string is "FAILED" the game will request that the user logs in again and then repeat the alarm to check the status once more.